<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <title>admin</title>

    <meta name="keywords" content="">
    <meta name="description" content="">
    <link rel="shortcut icon" href="/favicon.ico" />
    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html" />
    <![endif]-->

    <link rel="stylesheet" type="text/css" href="/static/css/admin/bootstrap.min14ed.css" />
	<link rel="stylesheet" type="text/css" href="/static/css/admin/font-awesome.min93e3.css" />
	<link rel="stylesheet" type="text/css" href="/static/css/admin/plugins/dataTables/dataTables.bootstrap.css">
	<link rel="stylesheet" type="text/css" href="/static/css/admin/animate.min.css" />
	<link rel="stylesheet" type="text/css" href="/static/css/admin/style.min862f.css"/>
    <link href="/static/css/admin/admincommon.css?v=20180820" rel='stylesheet' type='text/css' />
        <style>

            .select-box{border:solid 1px #ddd;box-sizing:border-box;vertical-align:middle; width:20%; display:inline-block}
            .select{border:solid 1px #ddd;box-sizing:border-box;cursor: pointer;line-height:normal;font-weight: normal;width:100%; white-space:nowrap}
            .select-box .select{ border:none}
            .select-box.inline,.select-box.inline .select{ width:auto}
            .select-box,.select-box.size-M{padding:4px 5px}
            .select,.size-M .select{font-size: 14px}
            .select-box.size-MINI{padding:0px 5px}
            .size-MINI .select{font-size: 12px}
            .select-box.size-S{padding:3px 5px}
            .size-S .select{font-size: 12px}
            .select-box.size-L{padding:8px 5px}
            .size-L .select{font-size: 16px}
            .select-box.size-XL{padding:10px 5px}
            .size-XL .select{font-size: 18px}
            @media (max-width: 767px) {
                .responsive .select-box{ border:none}
                .responsive .select-box .select,
                .responsive .select{border:solid 1px #ddd; padding:10px;font-size:16px}
                .responsive .select-box,
                .responsive .select-box.size-M,
                .responsive .select-box.size-MINI,
                .responsive .select-box.size-S,
                .responsive .select-box.size-L,
                .responsive .select-box.size-XL{ height:auto; padding:0}
            }
        </style>
</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>奖金释放记录列表</h5>
                        <div class="ibox-tools">
                            <a href="javascript:location.replace(location.href);" class="btn btn-primary btn-circle" type="button" style="margin-bottom:0px;margin-right:10px;position:relative;top:-5px;" title="刷新">
                                <i class="fa fa-refresh"></i>
                            </a>
                        </div>
                    </div>
                    <div class="ibox-content">
                        <form action="" method="post">
                            <div class="form-group col-sm-3" style="padding-left:0px;">
                                <input type="text" id="keywords" name="keywords" value="{$keywords}" placeholder="用户名" class="form-control" onkeyup="searchTitle(this);" />
                            </div>
                            <span class="select-box">
                                  <select class="select" size="1" name="status">
                                    <option value="" selected>请选择状态</option>
                                    <option <?php if($status == 1) echo "selected"; ?>  value="1">待审核</option>
                                    <option <?php if($status == 2) echo "selected"; ?>  value="2">审核通过</option>
                                    <option <?php if($status == 3) echo "selected"; ?>  value="3">审核失败</option>
                                  </select>
                            </span>
                            <button type="submit" class="btn btn-xm btn-primary">搜索</button>
                        </form>
                        <table id="mytable" class="table table-striped table-bordered table-hover dataTables-example">
                            <thead>
                                <tr>
                                    <th>ID</th>
                                    <th>用户名</th>
                                    <th>奖金类型</th>
                                    <th>分红金额</th>
                                    <th>来自订单</th>
                                    <th>来自用户</th>
                                    <th>状态</th>
                                    <th>释放时间</th>
                                    <th>操作</th>
                                </tr>
                            </thead>
                            <tbody>
                                <volist name="data" id="vo">
                                    <tr class="gradeX" id="article-{$vo['id']}">
                                        <td>{$vo['id']}</td>
                                        <td>{$vo['uname']}</td>
                                        <td>
                                            <if condition="$vo['type'] eq 1">
                                                    社区分红
                                                <else/>
                                                    超级分红
                                            </if>
                                        </td>
                                        <td>{$vo['amount']}</td>

                                        <td>{$vo['order_id']}</td>

                                        <td>{$vo['from_uname']}</td>
                                        <td>
                                            <if condition="$vo['status'] eq 1">
                                                    待审核
                                                <elseif condition="$vo['status'] eq 2">
                                                    审核通过
                                                <else/>
                                                    审核失败
                                            </if>
                                        </td>
                                        <td>{$vo['add_time']|date='Y-m-d H:i:s',###}</td>
                                        <td class="center" align="center">
                                            <div class="btn-group">
                                                <button data-toggle="dropdown" class="btn btn-primary btn-xs dropdown-toggle" aria-expanded="false">操作 <span class="caret"></span>
                                                </button>
                                                <ul class="dropdown-menu">
                                                    <if condition="$vo['status'] eq 1">
                                                        <if condition="check_auth('admin/Order/checkBonusStatus')">
                                                            <!--<li><a href="javascript:;" data-id="{$vo['id']}" data-val="1" class="font-bold yes-article">通过</a></li>
                                                            <li><a href="javascript:;" data-id="{$vo['id']}" data-val="2" class="font-bold yes-article">拒接</a></li>-->
                                                        </if>
                                                    </if>
                                                </ul>
                                            </div>
                                        </td>
                                    </tr>
                                </volist>
                            </tbody>
                        </table>
                        {$page|raw}
                    </div>
                </div>
            </div>
        </div>
    </div>
    <js href="/static/js/admin/jquery.min.js"/>
	<js href="/static/js/admin/bootstrap.min.js"/>
	<js href="/static/js/admin/content.min.js"/>
    <js href="/static/js/admin/plugins/layui/layer/layer.js"/>
    <script type="text/javascript" src="/static/js/admin/admincommon.js?v=20180820"></script>

    <script>
    $(document).ready(function(){

        $(".ibox-content").on('click','.yes-article',function(){
            var order_id = $(this).data("id");
            var val = $(this).data("val");
            layer.confirm("你确定要操作ID为【"+order_id+"】的订单吗？", {

                btn: ['确定','取消'] //按钮

            }, function(){

                $.post("{:url('admin/Order/checkBonusRecord')}",{recordId:order_id,status:val},function(data){

                    if(data.code==200) {

                        layer.msg(data.msg, {time:500, icon:1});
                        window.location.replace(location.href);
                    }else{

                        layer.msg(data.msg, {time:500, icon:2});

                    }


                },'json');

            });
        });
    });
    
    function searchTitle(obj) {
        var keywords = $.trim($(obj).val());
          
        if(keywords.length<=0) {
            window.location.replace(location.href);
        }
    } 

    </script>

</body>
</html>